<!--  -->
<template>
  <van-tabbar :active="active" @change="onChange">
    <van-tabbar-item icon="home-o">首页</van-tabbar-item>
    <van-tabbar-item icon="search">消息</van-tabbar-item>
    <van-tabbar-item icon="friends-o">热门</van-tabbar-item>
    <van-tabbar-item icon="setting-o">我的</van-tabbar-item>
  </van-tabbar>
</template>

<script>
export default {
  name: '',
  props: ['active'],
  components: {

  },
  data () {
    return {
      list: [
        '/pages/home/main',
        '/pages/msg/main',
        '/pages/hot/main',
        '/pages/center/main'
      ]
    }
  },

  computed: {},

  mounted () { },

  methods: {
    onChange (event) {
      console.log(event)
      // event.detail 的值为当前选中项的索引
      const index = event.mp.detail
      wx.switchTab({ url: this.list[index] })
    }
  }
}
</script>
<style scoped  >
</style>
